#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;

void solve()
{
    int n;
    cin >> n;
    map<int, int> mp;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        mp[x]++;
    }
    int  t = 0, sum = mp.size();
    for(auto [k, v] : mp) {
        if(v == 1) t++;
    }
    sum -= t;
    cout << sum + ((t + 1) / 2) * 2 << endl;
}

int main()
{
    int t = 1;
    cin >> t;
    while (t--)
        solve();
    return 0;
}